Skip to content

Implement automatic auth token checking#482

Merged
MattyTheHacker merged 89 commits into
mainfrom
481-auto-auth-check
Jul 5, 2025
Merged

Implement automatic auth token checking#482
MattyTheHacker merged 89 commits into
mainfrom
481-auto-auth-check

Conversation

@MattyTheHacker

@MattyTheHacker MattyTheHacker commented May 3, 2025

Copy link
Copy Markdown
Member

No description provided.

@MattyTheHacker MattyTheHacker added the enhancement New feature or request label May 3, 2025
@MattyTheHacker MattyTheHacker self-assigned this May 3, 2025
@MattyTheHacker MattyTheHacker linked an issue May 3, 2025 that may be closed by this pull request
@MattyTheHacker MattyTheHacker enabled auto-merge (squash) May 3, 2025 19:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request implements automatic auth token checking by introducing a new configuration function and integrating a background task to validate token sessions.

  • Adds a new method in the configuration for auto-checking of auth session cookies.
  • Refactors the token authorisation command cog and introduces a background task cog to regularly check token validity.
  • Updates the module imports accordingly.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
config.py Adds _setup_auto_auth_session_cookie_checking to validate and convert env var values into a timedelta.
cogs/get_token_authorisation.py Refactors token authorisation logic, standardizes command implementation, and adds a background task cog.
cogs/init.py Adjusts imports to include the new TokenAuthorisationCheckTaskCog.

Comment thread config.py Outdated
Comment thread cogs/get_token_authorisation.py Outdated
Comment thread cogs/get_token_authorisation.py Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds automatic checking of the SU platform access cookie’s validity and permissions, both on demand and as a background task.

  • Introduces two new config setups for enabling auto-checking and parsing its interval.
  • Extracts authorisation logic into a shared TokenStatus enum and helper methods, and adds separate command and background task cogs.
  • Registers the new Task Cog in cogs/__init__.py.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
config.py Added _setup_auto_su_platform_access_cookie_checking and interval parsing.
cogs/check_su_platform_authorisation.py Created TokenStatus, get_token_status, get_token_groups, command & task cogs.
cogs/init.py Imported and registered CheckSUPlatformAuthorisationTaskCog.
Comments suppressed due to low confidence (1)

config.py:485

  • [nitpick] The variable name raw_auto_auth_session_cookie_checking is ambiguous and inconsistent with the method name. Consider renaming it to raw_auto_su_platform_access_cookie_checking for clarity.
        raw_auto_auth_session_cookie_checking: str = str(

Comment thread cogs/check_su_platform_authorisation.py Outdated
Comment thread cogs/check_su_platform_authorisation.py Outdated
Comment thread config.py Outdated
Comment thread cogs/check_su_platform_authorisation.py Outdated
Comment thread config.py Outdated
Comment thread cogs/check_su_platform_authorisation.py Outdated
Comment thread cogs/check_su_platform_authorisation.py Outdated
Comment thread cogs/check_su_platform_authorisation.py Outdated
Comment thread cogs/check_su_platform_authorisation.py Outdated
Comment thread cogs/check_su_platform_authorisation.py Outdated
Comment thread config.py Outdated
Comment thread config.py Outdated
Comment thread config.py Outdated
Comment thread config.py Outdated
Comment thread config.py
MattyTheHacker and others added 3 commits July 5, 2025 20:46
Co-authored-by: Matt Norton <matt@carrotmanmatt.com>
Signed-off-by: Matty Widdop <18513864+MattyTheHacker@users.noreply.github.com>
@MattyTheHacker

Copy link
Copy Markdown
Member Author

quite annoyingly I can't actually test if these changes have broken anything cos we don't know if anyone has a working token

@CarrotManMatt

Copy link
Copy Markdown
Member

Indeed🙁

Comment thread config.py Outdated
Comment thread cogs/check_su_platform_authorisation.py Outdated
Comment thread cogs/check_su_platform_authorisation.py Outdated
Comment thread cogs/check_su_platform_authorisation.py Outdated
Comment thread cogs/check_su_platform_authorisation.py Outdated
Comment thread cogs/check_su_platform_authorisation.py Outdated
Comment thread cogs/check_su_platform_authorisation.py Outdated
Co-authored-by: Matt Norton <matt@carrotmanmatt.com>
Signed-off-by: Matty Widdop <18513864+MattyTheHacker@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request sync Request bots to automatically keep this PR up to date with it's base branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement automatic checking that the auth token is still valid

5 participants